{% load i18n admin_static %}
<h3>{% blocktrans with filter_title=title %} By {{ filter_title }} {% endblocktrans %}</h3>
<script>
    function datefilter_apply(event, qs_name, form_name){
        event.preventDefault();
        var query_string = django.jQuery('input#'+qs_name).val();
        var form_data = django.jQuery('#'+form_name).serialize();
        window.location = window.location.pathname + query_string + '&' + form_data;
    }
    function datefilter_reset(qs_name){
        var query_string = django.jQuery('input#'+qs_name).val();
        window.location = window.location.pathname + query_string;
    }
</script>
<div class="changelist-filter-popup admindatefilter">
    <input class="changelist-filter-popup-toggle" type="text" value="{% blocktrans with filter_title=title %} By {{ filter_title }} {% endblocktrans %}" readonly>
    <div class="changelist-filter-popup-content">
        <form method="GET" action="." id="{{ choices.0.system_name }}-form">
            {{ spec.form.media }}
            <fieldset class="module aligned">
                {% for field in spec.form %}
                    <div class="form-row {{ field.id }}">
                        <div>
                            {{ field }}
                        </div>
                    </div>
                {% endfor %}
            </fieldset>
            {% for choice in choices %}
                <input type="hidden" id="{{ choice.system_name }}-query-string" value="{{ choice.query_string }}">
            {% endfor %}
            <div class="controls">
                <input type="button" value="{% trans "Search" %}" onclick="datefilter_apply(event, '{{ choices.0.system_name }}-query-string', '{{ choices.0.system_name }}-form')">
                <input type="reset" class="button" value="{% trans "Reset" %}" onclick="datefilter_reset('{{ choices.0.system_name }}-query-string')">
            </div>
        </form>
    </div>
</div>
